package com.vipsoft.ws.client.controller;


import cn.hutool.core.util.StrUtil;
import com.vipsoft.ws.client.service.IDemoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DefaultController {
    Logger logger = LoggerFactory.getLogger(this.getClass());

    @Value("${server.application.name}")
    private String name;

    @Value("${server.port}")
    private String port;

    @Autowired
    private IDemoService demoService;


    @RequestMapping("/")
    public String test() {
        return StrUtil.format("{} {}", name, port);
    }

    @RequestMapping("/soap/cxf/{param}")
    public String soapTest(@PathVariable(name = "param") String param) {
        return demoService.soapTest(param);
    }


    @RequestMapping("/soap/dynamic/{param}")
    public String soapDynamicTest(@PathVariable(name = "param") String param) {
        return demoService.soapDynamicTest(param);
    }
}
